#include "AReVi/arSystem.h"
#include "AReVi/scheduler.h"
using namespace AReVi;

#include "fifo.h"

//----------------------------------------------------------------------------

int main(int argc, char ** argv) {
    ArSystem arevi(argc,argv);

    FIFO::REGISTER_CLASS();
    cout << "Appending data ..." << endl;
	ArRef<FIFO> fifo = FIFO::NEW();
	for (unsigned int i = 0; i < 100000; i++) {
		fifo->append(sizeof(unsigned int), (char *)&i);
		if (i % 5) fifo->unstack(sizeof(unsigned int));
	}
	cout << "Size of stack : " << fifo->getSize() << endl;
	
	cout << "Extracting data ..." << endl;
	while (fifo->getSize() >= sizeof(unsigned int)) {
		unsigned int i = 0;
		fifo->extract(sizeof(unsigned int), (char *) &i);
	}
	cout << fifo->getSize() << " bytes remaining" << endl;

    return(0);
}

